<template>
    <p>用户选择的爱好：{{ likes }}</p>
    <input type="checkbox" value="1" v-model="likes"><label>吃饭</label>
    <input type="checkbox" value="2" v-model="likes"><label>睡觉</label>
    <input type="checkbox" value="3" v-model="likes"><label>打游戏</label>
    <button @click="likes.includes('3')?'':likes.push('3')">添加一个爱好</button>
    
    
</template>

<script setup>
import { ref } from 'vue';
const likes = ref([]);
</script>

<style scoped>

</style>